#ifndef PROJECT_VECTOR_H
#define PROJECT_VECTOR_H

#include <stdbool.h>

const int minCapacity = 16;
const int growFactor = 2;
const int shrinkFactor = 4;

typedef struct VectorImpArr {
    int size;
    int capacity;
    int *data;
} MyVector;

int myVectorSize(MyVector *vecPtr);
int myVectorCapacity(MyVector *vecPtr);
bool isMyVectorEmpty(MyVector *vecPtr);
int myVectorAt(MyVector *vecPtr, int i);

// Create a vector
MyVector *myVectorNew(int capacity);

// Appends the given item to the end of the array.
void myVectorPush(MyVector *vecPtr, int n);

int myVectorDetermineCapacity(int capacity);

// Inserts the given value at the given index, shifting
// current and trailing elements to the right.
void myVectorInsert(MyVector *vecPtr, int index, int value);

// Check whether resizing is needed, and resize accordingly
void myVectorResizeForSize(MyVector *vecPtr, int size);

// Prepend, to insert n at index 0
void myVectorPrepend(MyVector *vecPtr, int n);

// Pop. No need to free memory. Change size.
int myVectorPop(MyVector *vecPtr);

// Delete. Shift left.
void myVectorDelete(MyVector *vecPtr, int index);

// Remove. According to value.
void myVectorRemove(MyVector *vecPtr, int value);

// Find. Look for value and return index. -1 if not found.
int myVectorFind(MyVector *vecPtr, int value);

// To extend the vector.
void myVectorUpsize(MyVector *vecPtr);

void checkAddress(void *p);

// To shrink the vector.
void myVectorDownsize(MyVector *vecPtr);

#endif